package com.daiTest.Controller;
import com.daiTest.pojo.Employee;
import com.daiTest.Service.EmployeeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
//前端访问url employee
@RequestMapping("/employee")
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    //前端通过get方法访问 路径为List
    @GetMapping("list")
    public List<Employee> retList() {
        List<Employee> employees = employeeService.findAll();
        log.info("员工数据:{}", employees);
        return employees;
    }
}
